package cn.qp.controller;

import cn.qp.domain.User;
import cn.qp.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author qipan
 * @date 2020/01/03 13:59
 */
@Controller
public class MyBatisController {
    @Autowired
    public UserMapper userMapper;


    @RequestMapping("/query")
    @ResponseBody
    public List<User> queryAllUser() {
        final List<User> users = userMapper.queryUserList();
        users.forEach(System.out::println);
        return users;
    }
}
